package com.university.logistic.util;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class WebUtil {

    public static HttpServletRequest getRequest(){
        try {
            ServletRequestAttributes sra= (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
            return sra.getRequest();
        }catch (Exception e){
            return null;
        }
    }

    public static HttpServletResponse getResponse(){
        try {
            ServletRequestAttributes sra= (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
            return sra.getResponse();
        }catch (Exception e){
            return null;
        }
    }
}
